﻿using LJ.EventBus.HornedSerpent.Transport.Abstractions;
using LJ.EventBus.HornedSerpent.Transport.Abstractions.Pack;
using LJ.EventBus.HornedSerpent.Transport.Kafka.Internal;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LJ.EventBus.HornedSerpent.Transport.Kafka.Pack;

public abstract class EventBusHornedSerpentTransportKafkaPackBase : PackBase, IEventBusHornedSerpentTransportPack
{
    public override void Add(IPackContext packContext)
    {
        packContext.ConfigManager.Add<EventBusTransportConfig>("EventBus:Transport");

        packContext.DependencyManager.ServiceCollection.AddTransient<IEventBusConsumerClient, KafkaEventBusConsumerClient>();
        packContext.DependencyManager.ServiceCollection.AddSingleton<IEventBusConsumerClientFactory, KafkaEventBusConsumerClientFactory>();

        packContext.DependencyManager.ServiceCollection.AddSingleton<IEventBusTransport, KafkaEventBusTransport>();

        packContext.DependencyManager.ServiceCollection.AddSingleton<IKafkaConnectionPool, KafkaConnectionPool>();
    }

    public override void Use(IPackProvider packProvider)
    {
    }
}
